package com.zzh.wechatpay.exception;

import com.zzh.wechatpay.domain.JsonData;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author zzh
 * @description 自定义异常处理器
 * @date 2019/11/28
 */
@RestControllerAdvice
public class VideoExceptionHandel{
    @ExceptionHandler(value = Exception.class)
    public JsonData handel(Exception e) {
        if (e instanceof VideoException) {
            return JsonData.buildError("自定义异常!");
        }else {
            return JsonData.buildError("未知错误!");
        }
    }
}
